package com.cn.wanxi.servlet;

import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.NavModel;
import com.cn.wanxi.model.NewsModel;
import com.cn.wanxi.model.NewsTypeModel;
import com.cn.wanxi.service.CompanyService;
import com.cn.wanxi.service.NavService;
import com.cn.wanxi.service.NewsService;
import com.cn.wanxi.service.NewsTypeService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/news")
public class NewsServlet extends HttpServlet {
    CompanyService companyService = new CompanyService();
    NavService navService = new NavService();
    NewsTypeService newsTypeService = new NewsTypeService();
    NewsService newsService = new NewsService();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        CompanyModel companyModel = companyService.getCompany();
//        List<NavModel> navList = navService.getNavList();
//        List<NewsTypeModel> newsTypeList = newsTypeService.getNewsTypes();
//        List<NewsModel> newsList = newsService.getNewsList();
//        req.setAttribute("company", companyModel);
//        req.setAttribute("nav",navList);
//        req.setAttribute("newsTypes",newsTypeList);
//        req.setAttribute("news",newsList);
        req.getRequestDispatcher("/jsp/news.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
